<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Enkuso
 * Date: 11/22/12
 * Time: 4:01 PM
 * To change this template use File | Settings | File Templates.
 */
class reviewForm extends sfForm
{
    public function setup()
    {

        $this->widgetSchema['book_id'] = new sfWidgetFormInput();
        $this->widgetSchema['review'] = new sfWidgetFormInput();
        $this->widgetSchema['rate'] = new sfWidgetFormInput();
        $this->widgetSchema['user_id'] = new sfWidgetFormInput();

        $this->validatorSchema['book_id'] = new sfValidatorDoctrineChoice(array(
            'model'     => 'Book',
            'required'  => true
        ));
        $this->validatorSchema['review'] = new sfValidatorString(array(
            'required'  => true,
            'min_length'=> 20,
            'max_length'=> 2000,
        ));
        $this->validatorSchema['rate'] = new sfValidatorInteger(array(
            'required'  => true,
            'min'       => 1,
            'max'       => 5
        ));
        $this->validatorSchema['user_id'] = new sfValidatorDoctrineChoice(array(
            'required'  => true,
            'model'     => 'sfGuardUser'
        ));
    }

}
